#!/bin/sh

##################################################
## 用于收集环境变量并更新配置文件

#CONFIG_JSON_PATH=${CONFIG_JSON_PATH:-"./config.json"}
#
#key_string_prepare(){
#    echo $1| tr -d '"'| tr 'a-z' 'A-Z'
#}
#
#get_env_by_key(){
#    eval "echo $(echo \${$(key_string_prepare $1:-\"\")})"
#
#}
#
#result=$(cat $CONFIG_JSON_PATH) &&
#
#for key in $(jq 'keys[]' $CONFIG_JSON_PATH)
#do
#    if [ ! -z "$(get_env_by_key $key)" ] ; then
#        result=$(echo "$result" | jq ".$key=\"$(get_env_by_key $key)\"")
#    fi
#done &&
#
#echo $result|jq > $CONFIG_JSON_PATH

##################################################


case "$1" in
    server)
        echo "选择运行服务器"
        uvicorn main:app --host=0.0.0.0 --port=5000
    *)
        echo "参数为 server"
esac